# !/usr/bin/evn python3
# -*- coding: utf-8 -*-
# File Name: uploads.py
# Created Date: 2017-12-19 15:05:38
from flask import request, g
from qiniu import Auth, put_file
import uuid
import os
def upload():
    q = Auth(access_key="D2HoWxWkb2MHhZVO5J5902DyeGNA05csQJOomlg0", secret_key="TmrvwiSTzBO9snZ2dg8JOYuCQA19IetyN-gZpZT8")
    key = uuid.uuid4()
    bucket_name = "keeper"
    token = q.upload_token(bucket_name, key, 3600)
    f = request.files['file']
    f.save("/tmp/file")
    ret, info = put_file(token, key, "/tmp/file")
    return {
            'res': ret
            }


